import lombok.Data;

/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: Sheep
 * @author: xiayuanxing
 * @description: TODO
 * @date: 2021/12/18 15:42
 * @version: 1.0
 */

@Data
public class Sheep implements Cloneable{

    private String name;

    private int age;

    private String color;

    private String address="蒙古羊";

    public Sheep friend;//是对象，克隆是会如何处理，默认是浅拷贝

    public Sheep(String name, int age, String color) {
        super();
        this.name = name;
        this.age = age;
        this.color = color;
    }

    @Override
    public String toString() {
        return "Sheep{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                ", address='" + address + '\'' +
                '}';
    }

    @Override
    protected Object clone(){
        Sheep sheep =null;
        try {
           sheep = (Sheep)super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return sheep;
    }


}
